{% extends "ui/base.html" %}
{% load bob %}
{% load i18n %}

{% block content %}

{% if new_count == 0 and changed_count == 0 %}
<div class="alert alert-info">{% trans "No changes to show." %}</div>
{% else %}
<ul class="nav nav-tabs">
  <li {% if change_type == 'new' %}class="active"{% endif %}>
  <a href="{% url scan_list change_type='new'%}">
    ({{ new_count }}) {% trans 'New devices' %}
  </a>
  </li>
  <li {% if change_type == 'existing' %}class="active"{% endif %}>
  <a href="{% url scan_list change_type='existing'%}">
    ({{ changed_count }}) {% trans 'Changed devices' %}
  </a>
  </li>
</ul>

{% if change_type == 'existing' %}
<form class="form form-inline">
  {% for f in venture_service_filter_form %}
  <div class="control-group" style="display:inline-block">{{ f }}</div>
  {% endfor %}
  <div class="control-group" style="display:inline-block; vertical-align:top">
    <button class="btn btn-primary" type="submit">
      <i class="fugue-icon fugue-funnel"></i>
      Filter
    </button>
  </div>
</form>
{% endif %}

{% if params.change_type == 'new' and new_count > 0 or params.change_type == 'existing' and changed_count > 0 %}
<table class="table table-bordered table-striped">
  {% table_header columns url_query %}
  {% for scan_summary in bob_page %}
  <tr>
    {% if scan_summary.device %}
        <td><a href="{%url scan_results scan_summary.job_id%}?initial_device_id={{ scan_summary.device.id }}">
    {% else %}
        <td><a href="{%url scan_results scan_summary.job_id%}">
    {% endif %}
        {{ scan_summary.ipaddress }}
    </a></td> <!-- IP -->
    {% if change_type == 'existing' and scan_summary.device %}
    <td>
      {{ scan_summary.device.venture.name }}
    </td> <!-- Venture -->
    {% endif %}
    <td>{{ scan_summary.modified }}</td> <!-- Last scan time -->
    {% if change_type == 'existing' and scan_summary.device %}
    <td> <!-- Device -->
      <a href="{% url search details='info' device=scan_summary.device.id %}">
        {{ scan_summary.device }}
      </a>
    </td>
    {% endif %}
  </tr>
  {% endfor %}
</table>
{% else %}
<div class="alert alert-info">{% trans "No changes to show." %}</div>
{% endif %}

{% pagination bob_page url_query=url_query show_all=1 show_csv=0 fugue_icons=1 export_variable_name=export_variable_name %}
{% endif %}
{% endblock %}
